package com.augurit.common.tag.link;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class LinkTag extends ComponentTagSupport{
	private static final long serialVersionUID = 1L;
	
	private String href;
	private String id;
	private String debug;
	private String title;
	private String onfocus;
	private String onblur;
	private String onclick;
	private String onkeydown;
	private String onkeypress;
	private String onkeyup;	
	private String content;
	private String sessionPrivilege;
	
	public String getSessionPrivilege() {
		return sessionPrivilege;
	}

	public void setSessionPrivilege(String sessionPrivilege) {
		this.sessionPrivilege = sessionPrivilege;
	}

	public String getHref() {
		return href;
	}

	public String getId() {
		return id;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public Component getBean(ValueStack arg0,
			HttpServletRequest arg1,HttpServletResponse arg2){
		Links links =  new Links(arg0);
		links.setSessionPrivilege((String)arg1.getSession().getAttribute("privilege"));
		return links;	//返回buttons,处理业务逻辑
	}
	
	//获得参数
	protected void populateParams(){
		super.populateParams();
		Links links = (Links)component;
		links.setHref(href);
		links.setId(id);
		links.setDebug(debug);
		links.setTitle(title);
		links.setOnblur(onblur);
		links.setOnclick(onclick);
		links.setOnfocus(onfocus);
		links.setOnkeydown(onkeydown);
		links.setOnkeypress(onkeypress);
		links.setOnkeyup(onkeyup);
		links.setContent(content);
	}


	public String getDebug() {
		return debug;
	}

	public void setDebug(String debug) {
		this.debug = debug;
	}

	public String getTitle() {
		return title;
	}

	public String getOnfocus() {
		return onfocus;
	}

	public String getOnblur() {
		return onblur;
	}

	public String getOnclick() {
		return onclick;
	}

	public String getOnkeydown() {
		return onkeydown;
	}

	public String getOnkeypress() {
		return onkeypress;
	}

	public String getOnkeyup() {
		return onkeyup;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setOnfocus(String onfocus) {
		this.onfocus = onfocus;
	}

	public void setOnblur(String onblur) {
		this.onblur = onblur;
	}

	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}

	public void setOnkeydown(String onkeydown) {
		this.onkeydown = onkeydown;
	}

	public void setOnkeypress(String onkeypress) {
		this.onkeypress = onkeypress;
	}

	public void setOnkeyup(String onkeyup) {
		this.onkeyup = onkeyup;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
}














